<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="fa">
        <p>父亲</p>
        <span>礼物：{{like.money}}</span>
        <span>礼物2：{{like.house}}</span>
        <p>儿子</p>
        <son @child="shou"></son>
    </div>
    <template id="son">
        <div>
            <button @click="tofather">给爸爸</button>
        </div>
    </template>
    <script src="../vue.js"></script>
    <script>
        let son={
            template:'#son',
            data () {
                return {
                    liwu:{
                        money:1,
                        house:'bh',
                    }
                }
            },
            methods: {
                tofather(){
                    this.$emit('child',this.liwu);
                }
            }
        };
        new Vue({
            el:'#fa',
            components: {
                son,
            },
            data () {
                return {
                    like:{},
                }
            },
            methods: {
                shou(val){
                    //console.log(val);
                    this.like=val;
                }
            }
        })
    </script>
</body>
</html>